package com.sundi.ecsystem.web;


import com.sundi.eccommon.vo.MenuVo;
import com.sundi.eccommon.vo.ResultEntity;
import com.sundi.ecsystem.service.IEcMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Mht
 * @since 2020-02-25
 */
@RestController
@RequestMapping("/ecMenu")
public class EcMenuController {

    @Autowired
    IEcMenuService menuService;

    //查询所有的菜单选项
    @RequestMapping(value = "selectMents",method = RequestMethod.GET)
    public ResultEntity select(){
        List<MenuVo> list = menuService.selectMenus();
        return ResultEntity.ok(list);
    }

    //查询已经拥有的菜单
    @RequestMapping(value = "selectMentRoleByRid",method = RequestMethod.GET)
    public ResultEntity menuRoleByRid(Integer rid){
        List<Integer> MenuRoleByRid = menuService.selectMenuRoleByRid(rid);
        return ResultEntity.ok(MenuRoleByRid);
    }

}
